using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UpgradeMoneyShot:Upgrade {

	const float damageBuff = 0.1f;
	const int minimumClipSize = 2;

	protected override void ReloadingEventHandler(object sender,ReloadEventArgs e) {
		if(!IfReactWeaponEvent(sender,e)) return;

		if(e.stat.clipSize<=minimumClipSize) return;
		e.stat.ReplaceRound(AmmoManager.nameToId["gold"],false);

	}


	protected override void ProjectileFiringEventHandler(object _sender,ProjectileEventArgs e) {
		if(!IfReactProjectileEvent(_sender,e)) return;
		Projectile sender = _sender as Projectile;
		if(!sender.stat.consumedAmmo.ContainsKey(AmmoManager.nameToId["gold"])) return;
		int roundsConsumed = sender.stat.consumedAmmo[AmmoManager.nameToId["gold"]];
		sender.stat.damage.AddAdd(roundsConsumed*e.shooterWeapon.currentClip.clipSize*damageBuff,999);
		
	}
}
